/*
*************************************
* PocketGTT
*************************************
This file is part of PocketGTT.

PocketGTT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PocketGTT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PocketGTT.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

Item {
    id: btnSearchArrow

    width: parent.height;
    height: parent.height - 12

//    anchors.top: parent.top
    anchors.right: parent.right
    anchors.verticalCenter: parent.verticalCenter

    property color pressedColor: myWin.theme.blue_background

    Rectangle {
        anchors.centerIn: parent
        height: btnImgSearchArrow.height * 1.1
        width: btnImgSearchArrow.width  * 1.1
        color: btnMA.pressed ? parent.pressedColor : "transparent"
        radius: width / 4



    }
    Image {
        id: btnImgSearchArrow
        fillMode: Image.PreserveAspectFit
        height: parent.height - 20
        anchors.centerIn: parent
        source: "qrc:ui/play.svg"
    }

    MouseArea {
        id: btnMA
        anchors.fill: parent
        onClicked: {
            //                console.log("click");
            //                console.log(searchText.text);
            GTT.searchByString(searchText.text);
//            searchArrow.focus = true;
        }
    }

    states: [
        State {
            name: "info"
            when: !GTT.SelectMultipleStopsStatus && !myWin.statesMan.pageViewStatus
//            PropertyChanges { target: btnImgInfoBack; source: "qrc:ui/information_userguide.svg"}
            PropertyChanges { target: btnSearchArrow; pressedColor: myWin.theme.blue_background}
        },
        State {
            name: "backFromMultiPref"
            when: GTT.SelectMultipleStopsStatus && !myWin.statesMan.pageViewStatus
//            PropertyChanges { target: btnImgInfoBack; source: "qrc:ui/back.svg"}
            PropertyChanges { target: btnSearchArrow; pressedColor: myWin.theme.green_background}
        }

    ]

}
